package com.wondertek.poms.core.service.impl;

import com.wondertek.poms.common.service.impl.ServiceImpl;
import com.wondertek.poms.common.utils.CopyUtils;
import com.wondertek.poms.core.service.IPrdFreeFlowService;
import com.wondertek.poms.dao.po.PrdFreeFlow;
import com.wondertek.poms.dao.repo.IPrdFreeFlowDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author chenjijiang
 * @description
 */
@Slf4j
@Service
public class PrdFreeFlowServiceImpl extends ServiceImpl<PrdFreeFlow, Long> implements IPrdFreeFlowService {
	@Autowired
	private IPrdFreeFlowDao prdFreeFlowDao;

	@Override
	public PrdFreeFlow deleteLogic(Long id) {
		return null;
	}

	@Override
	public PrdFreeFlow merge(PrdFreeFlow model) {
		PrdFreeFlow prdFreeFlow = jpaRepository.getOne(model.getId());
		CopyUtils.copyProperties(model, prdFreeFlow);
		return jpaRepository.save(prdFreeFlow);
	}

	@Override
	public List<PrdFreeFlow> findAllByPomsIdAndPomsType(Long pomsId, Integer pomsType) {
		return prdFreeFlowDao.findAllByPomsIdAndPomsType(pomsId, pomsType);
	}

}
